#ifndef QUEUEAREA_H
#define QUEUEAREA_H


#include <QList>
#include "DataStructures.h"
#include <QWidget>
#include <QScrollArea>
#include "PreviewWidget.h"

class queueArea : public QScrollArea
{
	Q_OBJECT
public:
	queueArea(QWidget *parent = 0);
	void addPreview(PreviewWidget *preview);
	void removeFinished();
	inline bool isEmpty() const { return allPreviews.isEmpty(); }
	inline bool count() const { return allPreviews.count(); }
	QList<ImageToUpload> ImagesToUpload();
	inline qint64 totalSize() const {return this->totalSize_;}
	qint64 lastDelta (const int index) const;
	void started(const int index);
	void finished(const int index);
	void setUploadError(const int index, const QString &string);
	void setToDelete(const int index, const bool delete_);
	void lockRemoveButtons();
	void unlockRemoveButtons();
#ifndef NOPREVIEW
	const QPixmap* previewPxm(const int index) const;
#endif //NOPREVIEW
public slots:
#ifndef NOPREVIEW
	void setProgress(const int val, const int max, const int index);
#endif //NOGUI
	inline void setDontClearQueue(const bool dontClear = true) {
		this->dontClearQueue = dontClear; }
private:
	QList<PreviewWidget*> allPreviews;
	bool dontClearQueue;
	qint64 totalSize_;
private slots:
	void clearQueue();
	void removePreview(PreviewWidget* preview);
signals:
	void isEmpty(bool);
};

#endif // QUEUEAREA_H
